﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Survey.aspx.cs" Inherits="CRM.Web.SurveyManage.Survey" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title></title>
    <link href="<%= base.ResourcesPath + "Style/main.css" %>" rel="stylesheet" type="text/css" />
    <link href="<%= base.ResourcesPath + "Style/button.css" %>" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="<%= base.ResourcesPath %>Js/jquery-1.6.2.min.js" ></script>
    <script type="text/javascript" src="<%= base.ResourcesPath %>Js/My97DatePicker/WdatePicker.js"  defer="defer" ></script>
    <script type="text/javascript" src="<%= base.ResourcesPath %>Js/MaskTextBox.js" ></script>
    <script type="text/javascript" src="<%= base.ResourcesPath %>Js/button.js"></script>
    <script type="text/javascript" src="<%= base.ResourcesPath %>Js/Common.js"></script>
    <script type="text/javascript" >
        $(document).ready(function() {
            $('#btnItemsSearch').bind("click", function() {
                var url = 'ItemsSearch.aspx';
                var title = 'ItemsSearch';
                openModalDialog(url, title, 800, 600);
            });
        });
        //设置选择题库的题目
        function SetSelectItems(item_name) {
            $('#txtSELECTITEMS').val(item_name);
            return true;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
<table border="0" cellpadding="0" cellspacing="0" id="tTitle">
    <tr>
	<td class="left">
	    <img src="<%= base.ResourcesPath %>Images/title_left.gif" alt="" />
	</td>
	<td class="middle">
    <div class="pagetitle" style="width: 100%">
        <div><asp:Label ID="lblTitle" runat="server" Text="问卷编辑" ></asp:Label></div>
    </div>
	
	</td>
	<td class="right">
	    <img src="<%= base.ResourcesPath %>Images/title_right.gif" alt="" />
	</td>
    </tr>
</table>
    <div id="divMain" >
    <div style="width: 100%">
    <asp:Panel ID="plSURVEY" runat="server">
	<table border="1" cellpadding="0" cellspacing="0" class="table" >
	    <tr>
	        <td style="vertical-align:top; width:50%">
	        <table border="1" cellpadding="0" cellspacing="0" class="table">	            
	            <tr>
                        <td class="title">
                            问卷编号:
                        </td>
                        <td class="content">
                            <asp:TextBox ID="txtSURVEY_ID" runat="server" CssClass="txt" MaxLength="20" Rows="3" TextMode="SingleLine" Enabled="false"></asp:TextBox>
                        </td>
                    </tr>
	            <tr>
                        <td class="title">
                            问卷名称:
                        </td>
                        <td class="content">
                            <asp:TextBox ID="txtSNAME" runat="server" CssClass="txt txt90" MaxLength="20" Rows="3" TextMode="SingleLine" ></asp:TextBox>
                        </td>
                    </tr>
                <tr>
                        <td class="title">
                            创建日期:
                        </td>
                        <td class="content">
                            <asp:TextBox ID="txtSDATE" runat="server" CssClass="txt" MaxLength="20" Rows="3" TextMode="SingleLine" Enabled="false"></asp:TextBox>
                        </td>
                    </tr>
                <tr>
                        <td class="title">
                            问卷说明:
                        </td>
                        <td class="content">
                            <asp:TextBox ID="txtSINFO" runat="server" CssClass="txt txt90" MaxLength="20" Rows="3" TextMode="SingleLine"></asp:TextBox>
                        </td>
                    </tr
                    
                <tr>
                        <td class="title">
                            创建人员:
                        </td>
                        <td class="content">
                            <asp:TextBox ID="txtGHID" runat="server" CssClass="txt" MaxLength="20" Rows="3" TextMode="SingleLine"></asp:TextBox>
                        </td>
                    </tr>              
            </table>
            <div style="width: 100%;">
                <div class="btndiv">
                    <span class="btnspan">
                        <asp:Button ID="btnAdd" runat="server" Text="新添" CommandName="Add" CssClass="btn title_qd"
                            OnClick="btnAdd_Click" /></span>&nbsp;
                    <span class="btnspan"><asp:Button ID="btnOK" runat="server" Text="保存" CommandName="Save" CssClass="btn title_qd"
                            OnClick="btnOK_Click" /></span>&nbsp;
                    <span class="btnspan"><asp:Button ID="btnSurveyShow" runat="server" Text="问卷查看" CommandName="Save" CssClass="btn title_qd"
                            OnClick="btnSurveyShow_Click" /></span>
                </div>
            </div>
            </td>
            <td style="vertical-align:top; width:50%">
            <table border="0" cellpadding="0" cellspacing="0" class="table">
                <tr>
                    <td>
                    <dp:WebGridView ID="gvList" runat="server" CssClass="gridview" AutoGenerateColumns="False" OnRowCreated="gvList_RowCreated" OnRowDataBound="gvList_RowDataBound" OnRowDeleting="gvList_RowDeleting" AllowPaging="true" 
                    AllowSorting="true" PageSize="10"  SortExpressionValue="SURVEY_ID">
                    <Columns>
			        <asp:BoundField DataField="SURVEY_ID" HeaderText="问卷编号"  SortExpression="SURVEY_ID" />
			        <asp:BoundField DataField="SNAME" HeaderText="问卷名称"  SortExpression="SNAME" />
			        <asp:BoundField DataField="SDATE" HeaderText="创建日期"  SortExpression="SDATE" />
			        <asp:BoundField DataField="SINFO" HeaderText="问卷说明"  SortExpression="SINFO"/>
			        <asp:BoundField DataField="GHID" HeaderText="创建人员"  SortExpression="GHID" />
			        <asp:TemplateField HeaderText="操作" ShowHeader="False">
                        <itemtemplate>
                        <div style="white-space: nowrap;">
                            <asp:HyperLink id="hlModify" runat="server" NavigateUrl='<%# String.Format(ModifyUrl, Eval("SURVEY_ID").ToString(), "") %>'>详细</asp:HyperLink>
                            <asp:LinkButton id="lbtnDelete" runat="server" Text="删除" CommandName="Delete" CausesValidation="False" OnClientClick="return confirm('您确认要删除此条记录吗？');"></asp:LinkButton>            
                        </div>
				        </itemtemplate>
                        <headerstyle width="90px" />
                    </asp:TemplateField>
                    </Columns>	
                    <RowStyle CssClass="row" />
                    <AlternatingRowStyle CssClass="row2" />
                    <HeaderStyle CssClass="header" />	
                    <PagerStyle CssClass="pager" />	
                    </dp:WebGridView>
                </td>
                </tr>
            </table>
            </td>
        </tr>
	</table>
	</asp:Panel>
	</div>

	<div class="pagetitle" style="width: 100%">
        <div><asp:Label ID="Label1" runat="server" Text="题目编辑" ></asp:Label></div>
    </div>


    <div style="width: 100%">
    <asp:Panel ID="plITEMS" runat="server">
	<table border="1" cellpadding="0" cellspacing="0" class="table" >
	    <tr>
	        <td style="vertical-align:top; width:50%">
	        <table border="1" cellpadding="0" cellspacing="0" class="table">
                <tr style="display:none;">
                    <td class="title">
                        自增编号:
                    </td>
                    <td class="content">
                        <asp:TextBox ID="txtAUTOID" runat="server" CssClass="txt" MaxLength="20" 
                            Rows="3" TextMode="SingleLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="title">
                        题目编号:
                    </td>
                    <td class="content">
                        <asp:TextBox ID="txtITEM_ID" runat="server" CssClass="txt" MaxLength="20" 
                            Rows="3" TextMode="SingleLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="title">
                        题目名称:
                    </td>
                    <td class="content">
                        <asp:TextBox ID="txtITEM_NAME" runat="server" CssClass="txt txt90" 
                            Height="50px" MaxLength="100" Rows="3" TextMode="MultiLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="title">
                        所属问卷编号:
                    </td>
                    <td class="content">
                        <asp:TextBox ID="txtSURVEY_ID1" runat="server" CssClass="txt" Enabled="false" 
                            MaxLength="20" Rows="3" TextMode="SingleLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="title">
                        所属问卷名称:
                    </td>
                    <td class="content">
                        <asp:TextBox ID="txtSURVEY_NAME" runat="server" CssClass="txt txt90" Enabled="false" 
                            MaxLength="100" Rows="3" TextMode="SingleLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="title">
                        题目类型:
                    </td>
                    <td class="content">
                        <asp:DropDownList ID="ddlITEM_TYPE" runat="server" CssClass="ddl" ></asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="title">
                        题目是否允许输入:
                    </td>
                    <td class="content">
                        <asp:RadioButton ID="rbENINPUT0" runat="server" GroupName="rbENINPUT" ValidationGroup="rbENINPUT" Text="否" Checked="true" />
                        <asp:RadioButton ID="rbENINPUT1" runat="server" GroupName="rbENINPUT" ValidationGroup="rbENINPUT" Text="是" />
                    </td>
                </tr>
                <tr>
                    <td class="title">
                        题目是否必要:
                    </td>
                    <td class="content">
                        <asp:RadioButton ID="rbENNULL0" runat="server" GroupName="rbENNULL" ValidationGroup="rbENNULL" Text="否" Checked="true" />
                        <asp:RadioButton ID="rbENNULL1" runat="server" GroupName="rbENNULL" ValidationGroup="rbENNULL" Text="是" />
                    </td>
                </tr>
                <tr>
                    <td class="title">
                        题目描述:
                    </td>
                    <td class="content">
                        <asp:TextBox ID="txtIINFO" runat="server" CssClass="txt txt90" 
                            Height="50px" MaxLength="100" Rows="3" TextMode="MultiLine"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="title">
                        选择题库内容:
                    </td>
                    <td class="content">
                        <asp:TextBox ID="txtSELECTITEMS" runat="server" CssClass="txt txt90" MaxLength="100" Rows="3" TextMode="SingleLine" ></asp:TextBox>
                        <input id="btnItemsSearch" type="button" class="btn_search" />
                    </td>
                </tr>
            </table>
            <div style="width: 100%;">
                <div class="btndiv">
                    <span class="btnspan">
                        <asp:Button ID="btnAdd_ITEM" runat="server" Text="新添" CommandName="Add" CssClass="btn title_qd"
                            OnClick="btnAdd_Click" /></span>
                           &nbsp;
                        <span class="btnspan">
                        <asp:Button ID="btnOK_ITEM" runat="server" Text="保存" CommandName="Save" CssClass="btn title_qd"
                            OnClick="btnOK_Click" /></span>
                            &nbsp;
                        <span class="btnspan">
                        <asp:Button ID="btnSETITEM_OPTIONS" runat="server" Text="设定题目选项" 
                        CommandName="SetItem_Options" CssClass="btn title_qd" 
                        onclick="btnSETITEM_OPTIONS_Click"/></span>
                            &nbsp;
                </div>
            </div>
            </td>
            <td style="vertical-align:top; width:50%">
            <table border="0" cellpadding="0" cellspacing="0" class="table">
                <tr>
                    <td>
                        <dp:WebGridView ID="gvList_items" runat="server" CssClass="gridview" AutoGenerateColumns="False" OnRowCreated="gvList_RowCreated" OnRowDataBound="gvList_RowDataBound" OnRowDeleting="gvList_RowDeleting" AllowPaging="true" 
                        AllowSorting="true" PageSize="10"  SortExpressionValue="AUTOID">
                        <Columns>
                        <asp:BoundField DataField="AUTOID" HeaderText="自增编号"  SortExpression="AUTOID" Visible="false" />
			            <asp:BoundField DataField="ITEM_ID" HeaderText="题目编号"  SortExpression="ITEM_ID" />
			            <asp:BoundField DataField="ITEM_NAME" HeaderText="题目名称"  SortExpression="ITEM_NAME" />
			            <asp:BoundField DataField="ITEM_TYPE" HeaderText="题目类型"  SortExpression="ITEM_TYPE" />
			            <asp:BoundField DataField="SURVEY_ID" HeaderText="所属问卷编号"  SortExpression="SURVEY_ID" Visible="false"/>
			            <asp:BoundField DataField="ENINPUT" HeaderText="是否允许输入"  SortExpression="ENINPUT" />
			            <asp:BoundField DataField="ENNULL" HeaderText="是否必要"  SortExpression="ENNULL" />
			            <asp:TemplateField HeaderText="操作" ShowHeader="False">
                            <itemtemplate>
                            <div style="white-space: nowrap;">
                                <asp:HyperLink id="hlModify" runat="server" NavigateUrl='<%# String.Format(ModifyUrl,Eval("SURVEY_ID").ToString(),Eval("AUTOID").ToString()) %>'>详细</asp:HyperLink>
                                <asp:LinkButton id="lbtnDelete" runat="server" Text="删除" CommandName="Delete" CausesValidation="False" OnClientClick="return confirm('您确认要删除此条记录吗？');"></asp:LinkButton>            
                            </div>
				            </itemtemplate>
                            <headerstyle width="90px" />
                        </asp:TemplateField>
                        </Columns>	
                        <RowStyle CssClass="row" />
                        <AlternatingRowStyle CssClass="row2" />
                        <HeaderStyle CssClass="header" />	
                        <PagerStyle CssClass="pager" />	
                        </dp:WebGridView>
                    </td>
                </tr>
            </table>
            </td>
        </tr>
	</table>
	</asp:Panel>
	</div>
	</div>
    </form>
</body>
</html>
